package com.service;

import com.mapper.SysUserMapper;
import com.pojo.SysUser;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("sysUserService")
public class SysUserServiceImpl implements SysUserService{
    @Resource
    private SysUserMapper sysUserMapper;
    /**
     * 用户登录
     * @param account
     * @param password
     * @return
     */
    @Override
    public SysUser login(String account, String password) {
        if(account==null||password==null){
            return null;
        }
        SysUser sysUser=sysUserMapper.getByAccount(account);
        if(sysUser==null){
            return null;

        }
        if(!sysUser.getPassword().equals(password)){
            return null;
        }
        return sysUser;
    }

    @Override
    public boolean add(SysUser sysUser) {
        boolean result=false;
           if(sysUserMapper.add(sysUser)==1){
               result=true;
           }
        return result;
    }

    @Override
    public SysUser getUserById(String id) {
        return null;
    }

    @Override
    public boolean update(SysUser sysUser) {
        return false;
    }
}
